#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
    int lengthOfLIS(vector<int>& nums) {
        int n = nums.size();
        vector<int> dp(n);
        dp[0] = 1;
        int ret = dp[0];
        for (int i = 1; i < n; i++)
        {
            for (int j = i - 1; j >= 0; j--)
            {
                if (nums[i] > nums[j])
                {
                    dp[i] = max(dp[i], dp[j] + 1);
                }
                else
                {
                    dp[i] = max(dp[i], 1);
                }
            }
            ret = max(dp[i], ret);
        }

        return ret;
    }
};

int main()
{
    Solution s;
    vector<int> v;
    v.push_back(10);
    v.push_back(9);
    v.push_back(2);
    v.push_back(5);
    v.push_back(3);
    v.push_back(7);
    v.push_back(101);
    v.push_back(18);

    int ret =s.lengthOfLIS(v);
    cout << ret;
    return 0;
}